package com.sk.sourcecircle.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sk.sourcecircle.R;
import com.sk.sourcecircle.entity.NoticeInfoBean;

import java.util.List;

/**
 * Created by sk on 2017/12/26.
 */

public class NoticeAdapter extends BaseQuickAdapter<NoticeInfoBean.DataBean,BaseViewHolder> {

    public NoticeAdapter(int layoutResId, @Nullable List<NoticeInfoBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, NoticeInfoBean.DataBean item) {
        helper.setText(R.id.notice_title,item.getTitle())
                .setText(R.id.tv_time,item.getCreate_time());
        if(item.getHead_url()!=null&&item.getHead_url().length()>0){
            helper.setGone(R.id.item_bg,true);
            Glide.with(mContext).load(item.getHead_url()).into((ImageView) helper.getView(R.id.item_bg));
        }else {
            helper.setGone(R.id.item_bg,false);
        }

    }
}
